package com.sjm.suchbear.easymap.Util;

import android.content.Context;
import android.content.SharedPreferences;

import static android.content.Context.MODE_PRIVATE;

/**
 * Created by Suchbear on 2018/3/31.
 */
public class SP {
    public static void setLoginUser(Context context, String username, String uid, String password) {
        SharedPreferences.Editor editor = context.getSharedPreferences("data", MODE_PRIVATE).edit();
        editor.putString("LoginUserName", username);
        editor.putString("LoginUid", uid);
        editor.putString("password", password);
        editor.apply();
    }

    public static String getUid(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("data", MODE_PRIVATE);
        String uid = sharedPreferences.getString("LoginUid", "");
        return uid;
    }

    public static String getLoginUserName(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("data", MODE_PRIVATE);
        String username = sharedPreferences.getString("LoginUserName", "");
        return username;
    }

    public static String getPassword(Context context){
        SharedPreferences sharedPreferences = context.getSharedPreferences("data", MODE_PRIVATE);
        String password = sharedPreferences.getString("password", "");
        return password;
    }
}
